<div data-role="header">
    <a href="#myPanel" class="ui-btn ui-icon-grid ui-btn-icon-left">菜单</a>
    <h1>订单确认</h1>
    <a href="javascript:history.back(-1);" class="ui-btn ui-icon-back ui-btn-icon-left">返回</a>
</div>
<style type="text/css">
    #callAjaxForm .ui-grid-b{margin:15px 0;}
    #callAjaxForm .ui-grid-b span{font-size: 16px}
    #callAjaxForm .ui-block-a span{font-weight: bold;}
    #callAjaxForm label{font-weight: bold;}
</style>

<div data-role="main" class="ui-content">
    <form method="post" action="<?=site_url('order/user_update')?>" id="callAjaxForm">

        <!-- <label for="fname">用户名:</label>
        <input type="text" name="username" data-clear-btn="true">
        <label for="fname">密码:</label>
        <input type="password" name="password" data-clear-btn="true">
        <label for="fname">验证码:</label>
        <input type="text" name="cap" data-clear-btn="true"> -->
        <div class="ui-grid-b">
            <div class="ui-block-a">
                <span>订单ID：</span>
            </div>
            <div class="ui-block-b|c">
                <span><?=$res['id']?></span>
            </div>
        </div>
        <div class="ui-grid-b">
            <div class="ui-block-a">
                <span>购买项目：</span>
            </div>
            <div class="ui-block-b|c">
                <span><a href="<?=site_url('parameters/show?pid='.$res_par['id'])?>"><?=$res_par['title']?></a></span>
            </div>
        </div>
        <div class="ui-grid-b">
            <div class="ui-block-a">
                <span>项目价格：</span>
            </div>
            <div class="ui-block-b|c">
                <span><?=$res['price']?></span>
            </div>
        </div>
        <div class="ui-grid-b">
            <div class="ui-block-a">
                <span>系统备注：</span>
            </div>
        </div>
        <div class="ui-grid-solo" style="margin-bottom: 40px">
            <span><?=$res['remarks']?></span>
        </div>


        <label for="fname">联系人姓名:</label>
        <input type="text" name="user_name" value="<?=$_SESSION['uinfo']['name']?>" data-clear-btn="true">
        <label for="fname">联系人电话:</label>
        <input type="text" name="user_phone" value="<?=$_SESSION['uinfo']['phone']?>" data-clear-btn="true">
        <label for="fname">备注:</label>
        <input type="text" name="content" value="" data-clear-btn="true">

        <input type="hidden" name="oid" value="<?=$res['id']?>">
        <input type="submit" value="付款" id="submit">
        <input type="reset" value="取消">
    </form>
</div>

<script type="text/javascript">
    function onSuccess(data, status)
    {
        if(data == 1){
            location.href="<?=site_url('order/oinfo?oid='.$res['id'])?>";
        }else{
            layer.open({
                content: data,
                style:'width:100%',
                btn: ['确定']
            });
        }
    }

    function onError(data, status)
    {
        alert(data);
    }

    $(document).ready(function() {
        $("#submit").click(function(){

            var formData = $("#callAjaxForm").serialize();

            $.ajax({
                type: "POST",
                url: "<?=site_url('order/user_update')?>",
                cache: false,
                data: formData,
                success: onSuccess,
                error: onError
            });

            return false;
        });
    });
</script>

